<?php

/**
 * Breadcrumb
 *
 * @package Rapide_Util
 */
class Rapide_Util_Breadcrumb
{
	private static $_oInstance;
	private $_aEntries = array();

	private function __construct()
	{
	}

	/**
	 * Get actual instance
	 *
	 * @return Rapide_Util_Breadcrumb
	 */
	public static function getInstance()
	{
		if(!self::$_oInstance instanceof self)
		{
			self::$_oInstance = new self;
		}

		return self::$_oInstance;
	}

	/**
	 * Add next element
	 *
	 * @param string $sEntry element's name
	 * @param string $sUrl element's url
	 */
	public function add($sEntry, $sUrl)
	{
		$this->_aEntries[] = array($sEntry, $sUrl);
	}

	/**
	 * Pop last element from the list
	 *
	 * @return array last element from the list
	 */
	public function pop()
	{
		return array_pop($this->_aEntries);
	}

	/**
	 * Remove all elements
	 *
	 */
	public function clear()
	{
		$this->_aEntries = array();
	}

	/**
	 * Get array of elements
	 *
	 * @return array
	 */
	public function getArray()
	{
		return $this->_aEntries;
	}
}

?>